<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue2.js"></script>
</head>
<body>

<!--
        按键修饰符
        @keydown.enter      监听 enter按键的按下
        .tab
        .delete (捕获“删除”和“退格”键)
        .esc
        .space
        .up
        .down
        .left
        .right
-->
<div id="app">
    <input type="text" placeholder="请输入内容"   v-model="msg" @keydown.enter="getInfo()" >
    <p >input表单中输入的内容是:{{ info }}</p>
</div>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            msg:'',
            info: ''
        },
        methods: {
            getInfo(){
                this.info = this.msg
                console.log("按键被按下")
            }
        }
    })
</script>
</body>
</html>